import ZDialog from './ZDialog'

export default {
  install (Vue, router, store) {
    const DialogConstructor = Vue.extend(ZDialog)

    Vue.prototype.dialog = options =>
      new Promise(resolve => {
        setTimeout(
          () => {
            resolve(new DialogConstructor({ propsData: options, store, router }).$mount())
          },
          options.deferred ? 150 : 0
        )
      })
  }
}
